<template>
	<view class="wrapper">
		<textarea v-model="intro" placeholder="填写圈子简介" />
		<div class="btn-wrapper">
			<div class="btn btn-into" @click="editCircleInfo">
				保存
			</div>
		</div>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				intro:'这是圈子简介'
			};
		},
		methods:{
			async editCircleInfo(){
				let params={
					user_token:uni.getStorageSync('userToken'),
					circle_id:this.circle_id,
					desc:this.intro
				};
				let res=await this.$api.editCircleInfo(params);
				if(res.data.level=='success'){
					setTimeout(()=>{
						uni.navigateBack({
							delta:1
						})
					},2000)
				}
				uni.showToast({
					icon:'none',
					title:res.data.message
				})
			},
		},
		onLoad(options) {
			this.intro=this.$bus.$data.circleIntro
			this.circle_id=options.circle_id
		},
		onHide() {
			this.$bus.$data.circleIntro=''
		},
		onUnload() {
			this.$bus.$data.circleIntro=''
		}
	}
</script>

<style lang="scss" scoped>
	@import '~@/static/scss/mixin.scss';
	.wrapper{
		
		textarea{
			margin:0 20rpx;
			
		}
		.btn-wrapper{
			width: 100%;
			@include flex();
			position: fixed;
			bottom: 0;
			background: #fff;
			.btn{
				background: #DADADA;
				margin: 20rpx 0;
				margin-left:30rpx;
				font-size:28rpx;
				text-align: center;
				font-weight: 600;
				
				width:80%;
				border-radius: 16rpx;
				height: 80rpx;
				line-height: 80rpx;
			}
			.btn-into{
				background: #FFE226;
			}
		}
	}
</style>
